package com.itheima.chapter09.file;

import java.io.File;

//File的判断和获取功能
public class FileDome4 {
    public static void main(String[] args) {
        method1();
        method2();
        method3();
        method4();
    }

    private static void method4() {
        File file1 = new File("D:\\my_project\\ab");
        File file = new File("D:\\my_project\\b.txt");
        System.out.println(file.getName());
        System.out.println(file1.getName());
    }

    private static void method3() {
        File file1 = new File("D:\\my_project\\ab");
        System.out.println(file1.exists());
        System.out.println("----------------------");

    }

    private static void method2() {
        File file1 = new File("D:\\my_project\\ab");
        //判断是否是文件
        System.out.println(file1.isFile());
        //判断是否是目录
        System.out.println(file1.isDirectory());
        System.out.println("----------------------");
    }

    private static void method1() {
        File file = new File("D:\\my_project\\b.txt");
        //判断是否是文件
        System.out.println(file.isFile());
        //判断是否是目录
        System.out.println(file.isDirectory());
        System.out.println("----------------------");
    }
}
